package com.shi.util;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;

public class ESUtil {
    private static RestHighLevelClient restHighLevelClient;

    static {
        RestClientBuilder restClientBuilder = RestClient.builder(new HttpHost("127.0.0.1", 9200, "http"));
        restHighLevelClient = new RestHighLevelClient(restClientBuilder);
        System.out.println("==========Connect to Elasticsearch successfully================");
    }

    public static RestHighLevelClient getRestHighLevelClient() {
        return restHighLevelClient;
    }

}

